// ElementDefSelectionFactoryVersionOne.cpp: implementation of the ElementDefSelectionFactoryVersionOne class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ElementDefSelectionFactoryVersionOne.h"

#include "SpecDefApp.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
namespace Specification
{
	ElementDefSelectionFactoryVersionOne::ElementDefSelectionFactoryVersionOne()
	{
 
	}

	ElementDefSelectionFactoryVersionOne::~ElementDefSelectionFactoryVersionOne()
	{

	}
	
	typeElementDefSelection ElementDefSelectionFactoryVersionOne::NewSelection(const StdString& strSpecID)
	{ 
		StdString source = SpecDefApp::Instance()->GetSpecDefPath();
		StdString strTblName = SpecDefApp::Instance()->GetSpecTblName();
		UEConnectionPtr connPtr;
		typeElementDefSelection recordSetPtr;
		try
		{
			connPtr = UEConnectionManager::Instance().GetConnection(source);
			StdString strsql;
			strsql = _T("select * from [") + strTblName + _T("] where SpecKey = '")+strSpecID+_T("' ");				
			recordSetPtr = connPtr->ExecuteSelectSQL(strsql);		
		}
		catch (UEException *e) 
		{
			e->ReportError();
			e->Delete();
		}
		return recordSetPtr;
	}
}


